package com.crawler.harbour.model;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.crawler.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * <p>
 * 
 * </p>
 *
 * @author hhd
 * @since 2018-06-01
 */
public class Notice extends Model<Notice> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 码头
     */
    private String portNo;
    /**
     * 船名
     */
    private String shipName;
    /**
     * 船名中文
     */
    private String shipCnName;
    /**
     * 进口航次
     */
    @JsonIgnore
    private String jkShipTimer;
    /**
     * 出口航次
     */
    @JsonIgnore
    private String ckShipTimer;
    /**
     * 进口船期
     */
    @JsonIgnore
    private String jkSailingDate;
    /**
     * 出口船期
     */
    @JsonIgnore
    private String ckSailingDate;
    /**
     * 可进场时间
     */
    private String intoDate;
    /**
     * 截箱时间
     */
    private String offDate;
    /**
     * 预泊时间
     */
    @JsonIgnore
    private String berthDate;
    /**
     * 预离时间
     */
    @JsonIgnore
    private String leaveDate;
    /**
     * 截关时间
     */
    @JsonIgnore
    private String cutOffDate;
    /**
     * 堆存天数
     */
    @TableField(exist=false)
    @JsonIgnore
	private String storageDays;
    /**
     * 截提单时间
     */
    @JsonIgnore
    private String offLadingDate;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    @JsonIgnore
    private Date updateTime;
    /**
     * 0未通知 1已通知
     */
    @JsonIgnore
    private Integer status;
    /**
     * 1新增2变更
     */
    @JsonIgnore
    private Integer type;
    
    /**
     * 放：原船期、进场时间、截箱时间
     */
    private String origValue;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPortNo() {
        return portNo;
    }

    public void setPortNo(String portNo) {
        this.portNo = portNo;
    }

    
    public String getShipName() {
		return shipName;
	}

	public void setShipName(String shipName) {
		this.shipName = shipName;
	}

	public String getShipCnName() {
		return shipCnName;
	}

	public void setShipCnName(String shipCnName) {
		this.shipCnName = shipCnName;
	}

	public String getJkShipTimer() {
		return jkShipTimer;
	}

	public void setJkShipTimer(String jkShipTimer) {
		this.jkShipTimer = jkShipTimer;
	}

	public String getCkShipTimer() {
		return ckShipTimer;
	}

	public void setCkShipTimer(String ckShipTimer) {
		this.ckShipTimer = ckShipTimer;
	}

	public String getJkSailingDate() {
		return jkSailingDate;
	}

	public void setJkSailingDate(String jkSailingDate) {
		this.jkSailingDate = jkSailingDate;
	}

	public String getCkSailingDate() {
		return ckSailingDate;
	}

	public void setCkSailingDate(String ckSailingDate) {
		this.ckSailingDate = ckSailingDate;
	}

	public String getIntoDate() {
		return intoDate;
	}

	public void setIntoDate(String intoDate) {
		this.intoDate = intoDate;
	}

	public String getOffDate() {
		return offDate;
	}

	public void setOffDate(String offDate) {
		this.offDate = offDate;
	}

	public String getBerthDate() {
		return berthDate;
	}

	public void setBerthDate(String berthDate) {
		this.berthDate = berthDate;
	}

	public String getLeaveDate() {
		return leaveDate;
	}

	public void setLeaveDate(String leaveDate) {
		this.leaveDate = leaveDate;
	}

	public String getCutOffDate() {
		return cutOffDate;
	}

	public void setCutOffDate(String cutOffDate) {
		this.cutOffDate = cutOffDate;
	}

	public String getOffLadingDate() {
		return offLadingDate;
	}

	public void setOffLadingDate(String offLadingDate) {
		this.offLadingDate = offLadingDate;
	}

	public String getStorageDays() {
		return storageDays;
	}

	public void setStorageDays(String storageDays) {
		this.storageDays = storageDays;
	}

	public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
    
    

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
    
    @JsonProperty("wharfName")
    public String getWharfName() {
    	if(StringUtils.isNullOrEmpty(this.getPortNo())) {
    		return "";
    	}
    	switch (this.getPortNo()) {
		case "FIC":
			return "福州江阴港";
		case "FQC":
			return "福州青州港";
		case "HYG":
			return "海盈港";
		case "HTD":
			return "海天码头";
		case "HRD":
			return "海润码头";
		case "H.C":
			return "厦门国际码头";
		case "HT":
			return "海通码头";
		case "XHD":
			return "新海达码头";
		case "YHT":
			return "远海码头";
		case "SYT":
			return "嵩屿码头";
		default:
			break;
		}
    	return "";
    }
    
    /**
     * 船期
     * @return
     */
    @JsonProperty("sailingDate")
    public String getSailingDate() {
        if(this.getType() == 4) {
        	return this.getJkSailingDate();
        }else {
             return this.getCkSailingDate();
        }
    }
    
    @JsonProperty("shipTimer")
    public String getShipTimer() {
        if(this.getType() == 4) {
        	return this.getJkShipTimer();
        }else {
             return this.getCkShipTimer();
        }
    }
    
    @JsonProperty("messageType")
    public Integer getMessageType() {
        return type==4? 1: type;
    }
    @Override
    public String toString() {
        return "Notice{" +
        ", id=" + id +
        ", portNo=" + portNo +
        ", shipName=" + shipName +
        ", shipCnName=" + shipCnName +
        ", jkShipTimer=" + jkShipTimer +
        ", ckShipTimer=" + ckShipTimer +
        ", jkSailingDate=" + jkSailingDate +
        ", ckSailingDate=" + ckSailingDate +
        ", intoDate=" + intoDate +
        ", offDate=" + offDate +
        ", berthDate=" + berthDate +
        ", leaveDate=" + leaveDate +
        ", cutOffDate=" + cutOffDate +
        ", offLadingDate=" + offLadingDate +
        ", createTime=" + createTime +
        ", updateTime=" + updateTime +
        ", status=" + status +
        ", type=" + type +
        "}";
    }

	public String getOrigValue() {
		return origValue;
	}

	public void setOrigValue(String origValue) {
		this.origValue = origValue;
	}

}
